Skip to content

Comments

Fix decoding QbftMessage#192

Merged
jking-aus merged 3 commits intosigp:unstablefrom
dknopik:fix-msgid
Mar 18, 2025
Merged

Fix decoding QbftMessage#192
jking-aus merged 3 commits intosigp:unstablefrom
dknopik:fix-msgid

Conversation

@dknopik
Copy link
Member

@dknopik dknopik commented Mar 17, 2025

Problem

The inner QbftMessage has a field identifier, which contains the message id. The message id is also contained in the outer SsvMessage.

As this is repeated, we used our type MessageId in both places, but the types actually differ, even though they contain the same data in every message:

https://github.com/ssvlabs/ssv-spec/blob/36c660085fd74464dcfd301a0084e1112ed264ea/qbft/messages.go#L51 vs https://github.com/ssvlabs/ssv-spec/blob/4066ef02de3c159ea9852bc5615358ca03384fba/types/messages.go#L96

We fail to decode the inner QbftMessage, as the field is tagged ssz-max, which indicates that this is a variable length field. This is encoded differently in SSZ vs a fixed sized field.

Solution

As the inner identifier is redundant anyway, don't bother with our custom type, and treat it as an opaque variable sized byte list with max length of 56. We still ensure that it is identical to the outer identifier.

@dknopik dknopik requested a review from jking-aus March 17, 2025 13:02
@dknopik dknopik added bug Something isn't working ready-for-review This PR is ready to be reviewed network labels Mar 17, 2025
@dknopik dknopik marked this pull request as ready for review March 17, 2025 13:03
Copy link
Member

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job mate -- I just added a todo for when we come back and fix this

@jking-aus jking-aus merged commit 9ecf557 into sigp:unstable Mar 18, 2025
10 checks passed
@dknopik dknopik deleted the fix-msgid branch June 20, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working network ready-for-review This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants